From 949ebc61f83ff7ef5d583cc1a1035e3b733bc67e Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Fri, 18 Nov 2005 19:25:17 +0100 Subject: [PATCH] Do not allow an uninitialised VCPU to be brought up. Also check VCPUOP_up return code in the guest and BUG() on failure. Signed-off-by: Keir Fraser --- linux-2.6-xen-sparse/arch/xen/kernel/smpboot.c | 3 ++- xen/common/domain.c | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/linux-2.6-xen-sparse/arch/xen/kernel/smpboot.c b/linux-2.6-xen-sparse/arch/xen/kernel/smpboot.c index 66bb891ec6..db15eb3dfb 100644 --- a/linux-2.6-xen-sparse/arch/xen/kernel/smpboot.c +++ b/linux-2.6-xen-sparse/arch/xen/kernel/smpboot.c @@ -410,7 +410,8 @@ int __devinit __cpu_up(unsigned int cpu) xen_smp_intr_init(cpu); cpu_set(cpu, cpu_online_map); - HYPERVISOR_vcpu_op(VCPUOP_up, cpu, NULL); + if (HYPERVISOR_vcpu_op(VCPUOP_up, cpu, NULL) != 0) + BUG(); return 0; } diff --git a/xen/common/domain.c b/xen/common/domain.c index 7398d79808..430c0b0a8c 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -425,7 +425,9 @@ long do_vcpu_op(int cmd, int vcpuid, void *arg) break; case VCPUOP_up: - if ( test_and_clear_bit(_VCPUF_down, &v->vcpu_flags) ) + if ( !test_bit(_VCPUF_initialised, &v->vcpu_flags) ) + rc = -EINVAL; + else if ( test_and_clear_bit(_VCPUF_down, &v->vcpu_flags) ) vcpu_wake(v); break; -- 2.30.2